/////precompiled////////
#include "precompiled.h"
////////////////////////


#include "prs_FrmSplitter.h"
using namespace prs;

// TRuleFrmVSplitter //////////////////////////////////////////////////////////

//
TRuleFrmVSplitter::TRuleFrmVSplitter(
  snt::text::TContext &Context,
  svl::TVariant &VParentNode,
  TRuleFrmChildrenBase &RChildren,
  TRuleSetNodeIdOptionally &RSetNodeIdOptionally,
  TRuleFrmGeom &RFrmGeom,
  TRuleSetAttrValue &RSetAttrValue,
  TRuleSetStyle &RStyle
) 
:vParentNode(VParentNode)
,rGeometry(RFrmGeom)
{
  snt::text::TSequence T(Context);
  snt::text::TKeyword K(Context);
  snt::TFVoid F;
  TFuncNewNodeIntoAttrOldChildren FNewNode;
  snt::TReturn Return;

  this->Name(GetClassName()).Local(vParentNode)
  | K.New("vSplitter") & FNewNode.New(vParentNode,TNodeFrmVSplitter()) 
    & RSetNodeIdOptionally.New() & RAttr.New() 
    & Return.New()
  ;
  
  RAttr
  | T.New("(") 
    & RAttr1.New() & RChildren.New() 
    & T.New(")") & Return.New()
  | Return.New()
  ;

  RAttr1
  | AAttr1.New()
  ;
  AAttr1
  | RSetAttrValue.New(
      VParentNode,
      TRuleSetAttrValue::TAttrs()
	    .Add(prs::TFrmDict::attrName_Weight),
	  RSetAttrValue.SetFuncValueIdent (this,&TRuleFrmVSplitter::FSetParam)
    )
    & AAttr1.New()
  | RStyle.New() & AAttr1.New()
  | F.New(this,&TRuleFrmVSplitter::FSetGeometry) & RFrmGeom.New() & AAttr1.New()
  | Return.New()
  ;
}

// TRuleFrmHSplitter //////////////////////////////////////////////////////////

//
TRuleFrmHSplitter::TRuleFrmHSplitter(
  snt::text::TContext &Context,
  svl::TVariant &VParentNode,
  TRuleFrmChildrenBase &RChildren,
  TRuleSetNodeIdOptionally &RSetNodeIdOptionally,
  TRuleFrmGeom &RFrmGeom,
  TRuleSetAttrValue &RSetAttrValue,
  TRuleSetStyle &RStyle
) 
:vParentNode(VParentNode)
,rGeometry(RFrmGeom)
{
  snt::text::TSequence T(Context);
  snt::text::TKeyword K(Context);
  snt::TFVoid F;
  TFuncNewNodeIntoAttrOldChildren FNewNode;
  snt::TReturn Return;

  this->Name(GetClassName()).Local(vParentNode)
  | K.New("hSplitter") & FNewNode.New(vParentNode,TNodeFrmHSplitter()) 
    & RSetNodeIdOptionally.New() & RAttr.New() 
    & Return.New()
  ;
  
  RAttr
  | T.New("(") 
    & RAttr1.New() & RChildren.New() 
    & T.New(")") & Return.New()
  | Return.New()
  ;

  RAttr1
  | AAttr1.New()
  ;
  AAttr1
  | RSetAttrValue.New(
      VParentNode,
      TRuleSetAttrValue::TAttrs()
	    .Add(prs::TFrmDict::attrName_Weight),
	  RSetAttrValue.SetFuncValueIdent (this,&TRuleFrmHSplitter::FSetParam)
    )
    & AAttr1.New()
  | RStyle.New() & AAttr1.New()
  | F.New(this,&TRuleFrmHSplitter::FSetGeometry) & RFrmGeom.New() & AAttr1.New()
  | Return.New()
  ;
}
